package com.yujianweb;

import java.util.Arrays;

//测试Arrays类
//实现二分法查找
//对数组进行填充
public class Test05 {
    public static void main(String[] args) {
        int[] a = {1,2,3,4};

        System.out.println(a);
        //打印数组列表
        System.out.println(Arrays.toString(a));

        //排序
        int[] b = {1,51,62,541,21,361,51};
        System.out.println(Arrays.toString(b));
        Arrays.sort(b);
        System.out.println(Arrays.toString(b));

        //实现二分法查找
        System.out.println("62元素的索引："+Arrays.binarySearch(b,62));

        //对数组进行填充
        int[] c = {2,52,56,584,125,23};
        Arrays.fill(c,2,4,20);
        System.out.println(Arrays.toString(c));
    }
}
